package com.example.feature.demo.listener;

import com.example.feature.demo.dto.Address;
import com.example.feature.demo.dto.Person;
import org.springframework.kafka.annotation.KafkaHandler;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

/**
 * MultiMethodsListener
 *
 * @author zhouxianfeng
 * @date 2021-4-19
 */
@Component
@KafkaListener(id = "multiGroup", topics = {"topic-zhou1", "topic-zhou2"})
public class MultiMethodsListener {

    @KafkaHandler
    public void foo(Person foo) {
        System.out.println("Received: " + foo);
    }

    @KafkaHandler
    public void bar(Address bar) {
        System.out.println("Received: " + bar);
    }

    @KafkaHandler(isDefault = true)
    public void unknown(Object object) {
        System.out.println("Received unknown: " + object);
    }

}
